(function () {
  function toFixedFix(n, prec) {
  　var k = Math.pow(10, prec);
  　return '' + Math.ceil(n * k) / k;
  };
  function numberFormat(prec = 0) {
  　var number = this + '';
  　var n = number.replace(/[^0-9+-Ee.]/g, '');
  　var sep = ',';
  　var dec = '.';
  　var s = '';
    if (number.indexOf('.') > -1) prec = 2;
  　s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
  　var re = /(-?\d+)(\d{3})/;
  　while(re.test(s[0])) {
      s[0] = s[0].replace(re, "$1" + sep + "$2");
  　}
  　if((s[1] || '').length < prec) {
      s[1] = s[1] || '';
      s[1] += new Array(prec - s[1].length + 1).join('0');
  　}
    return s.join(dec);
  }
  function scale(arg2) {
    var m = 0, s1 = this.toString(), s2 = arg2.toString(); 
    try{ m += s1.split(".")[1].length }catch(e){} 
    try{ m += s2.split(".")[1].length }catch(e){} 
    return Number(s1.replace(".","")) * Number(s2.replace(".","")) / Math.pow(10,m) 
  }
  
  String.prototype.numberFormat = numberFormat;
  Number.prototype.numberFormat = numberFormat;
  String.prototype.scale = scale;
  Number.prototype.scale = scale;
})();